
var timer = null;
function displayClock(num) {//num是传入的startClock中的动态值
  if (num < 10) {
    return "0" + num;
  }
  else {
    return num;
  }
}
//停止计时
function stopClock() {
  clearTimeout(timer);
}
//开始计时
function startClock() {
  var time = new Date();
  var year = time.getFullYear() + "-";
  var month = time.getMonth() + 1 + "-";
  var day = time.getDate() + " ";
  var hours = displayClock(time.getHours()) + ":";
  var minutes = displayClock(time.getMinutes()) + ":";
  var seconds = displayClock(time.getSeconds());
  //显示时间
  showshow.innerHTML = year + month + day;
  showshowshow.innerHTML = hours + minutes + seconds;
  timer = setTimeout("startClock()", 1000);
}


function showsigntime() {
  var time = new Date();
  var year = time.getFullYear() + "-";
  var month = time.getMonth() + 1 + "-";
  var day = time.getDate() + " ";
  var hours = displayClock(time.getHours()) + ":";
  var minutes = displayClock(time.getMinutes());
  signnow = year + month + day + hours + minutes;
  alert("您在 " + signnow + " 签到成功！");
}

function showsignouttime() {
  var time = new Date();
  var year = time.getFullYear() + "-";
  var month = time.getMonth() + 1 + "-";
  var day = time.getDate() + " ";
  var hours = displayClock(time.getHours()) + ":";
  var minutes = displayClock(time.getMinutes());
  signnow = year + month + day + hours + minutes;
  alert("您在 " + signnow + " 下班签到成功！");
}
function unpasspass() {
  document.getElementById("adminwords").style.display = "inline";
  document.getElementById("checkmessage1").style.display = "inline";
  document.getElementById("checkmessage2").style.display = "none";
  document.getElementById("adminback").value = 4;
}
function passpass() {
  document.getElementById("adminwords").style.display = "inline";
  document.getElementById("checkmessage2").style.display = "inline";
  document.getElementById("checkmessage1").style.display = "none";
  document.getElementById("adminback").value = 0;
}
function buttonshow() {

  var backup = document.getElementById("adminbackup").value;
  if (backup.replace(/(^s*)|(s*$)/g, "").length == 0) {
    document.getElementById("sa-submittt").disabled = true;
  }
  if (backup.replace(/(^s*)|(s*$)/g, "").length != 0) {
    document.getElementById("sa-submittt").disabled = false;
  }
}